package command;

import java.util.List;
import java.util.Map;

public class ResultNode {
	private String[][] table;
	private String[] header;
	private int rows_inserted;
	
	public ResultNode(Map<Integer,List<String>> table, List<String> header,int rows_inserted) {
		if(header!=null){
		this.header = new String[header.size()];
		int i = 0;
		for(String s : header) {
			this.header[i] = s;
			i++;
		}
		}
		if(table!=null){
		this.table = new String[table.keySet().size()][];
		
		for(Integer s : table.keySet()) {
			int j = 0;
			this.table[s] = new String[table.get(s).size()];
			for(String sr : table.get(s)) {
				this.table[s][j] = sr;
				j++;
			}
		}
		}
		this.rows_inserted = rows_inserted;
	}
	
	public String[][] getTable() {
		return table;
	}
	
	public int getNrRows(){
		return rows_inserted;
	}
	
	public String[] getHeader() {
		return header;
	}
}
